import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useProductStore = defineStore('productStore', () => {
  const products=ref([
        {
          id: 1,
          name: "iphone12",
          price: 3000,
          inventory: 3
        },
        {
          id: 2,
          name: "iphone13",
          price: 8000,
          inventory: 3
        },
        {
          id: 3,
          name: "iphone14",
          price: 13000,
          inventory: 2
        }
      ])
      /*
      请求后台要数据  
       async loadData() {
      let result = await axios.get('http://localhost:9000/data')
      this.products = result.data
    } */
      return { products }
  })

  
  

